import axios from "axios"
import type {AxiosInstance, AxiosRequestConfig, AxiosResponse} from "axios"
import {BASE_URL} from '../config/constants'
import {ElMessage, ElMessageBox} from "element-plus"
import  {clearAll} from "../utils/storageUtil"
import Nprogress from 'nprogress'
import type {ResultDefine} from '../types/common.d'
import type {userTabStoreExternal} from '../store/userTabStore'
import type {useUserStoreExternal} from '../store/useUserStore'
import qs from 'qs'


//对axios的全局设置
axios.defaults.baseURL = BASE_URL
axios.defaults.timeout = 1000 * 60 * 10 //单位ms
axios.defaults.headers.common['Content-Type'] = "application/json"

let userStore = useUserStoreExternal()
const tabStore = userTabStoreExternal()

/**
 * 创建axios实例
 */
const instance: AxiosInstance = axios.create()

/**
 * 给ElMessageBox添加请求，响应拦截器
 */